export const phoneRules = [
  { required: true, message: '请填写手机号!' },
  {
    pattern: /^(\+?0?86\-?)?1[3|4|5|7|8|9][0-9]\d{8}$/,
    message: '请输入正确的手机号',
  },
];

export const emailRules = [
  { required: true, message: '请填写邮箱!' },
  {
    pattern: /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/,
    message: '请输入正确的邮箱号',
  },
];

export const decimalDigitRules = [
  {
    pattern: /^(\d+)(\.\d{1})?$/,
    message: '请输入整数或小数位数限制为一位',
  },
];

export const dobuleRules = [
  {
    pattern: /^\d+(\.\d+)?$/,
    message: '请输入非负浮点数',
  },
];

export const noRequiredEmailRules = [
  {
    pattern: /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/,
    message: '请输入正确的邮箱号',
  },
];

export const positiveRules = [
  {
    pattern:
      /^[+]{0,1}[1-9]\d*$|0|^[+]{0,1}(0\.\d*[1-9])$|^[+]{0,1}([1-9]\d*\.\d*[1-9])$/,
    message: '请输入正整数',
  },
];
